<template>
    <div>
        <el-dialog @close="closeFn" v-model="visibles" width="25%" title="修改密码" :show-close="true">
            <div class="Changinput">
                <div class="top f f-a-c">
                    <div class="yuan">* </div>原密码
                </div>
                <input type="password" v-model="yuanValue" placeholder="请输入原密码" class="inp" name="" id="">
            </div>
            <div class="Changinput">
                <div class="top f f-a-c">
                    <div class="yuan">* </div>新密码
                </div>
                <input type="password" v-model="newValue" placeholder="请输入新密码" class="inp" name="" id="">
            </div>
            <div class="Changinput">
                <div class="top f f-a-c">
                    <div class="yuan">* </div>确认密码
                </div>
                <input type="password" v-model="newOldValue" placeholder="确认新密码" class="inp" name="" id="">
            </div>
            <div class="bot f f-a-c ">
                <div @click="canel" class="left">取消</div>
                <div @click="comfig" class="right">确认</div>
            </div>
        </el-dialog>
    </div>
</template>

<script setup>
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import { changePassword } from '../../api/index'
// import second from ''
let visibles = ref(false)
let yuanValue = ref('')//原密码
let newValue = ref('')//新密码
let newOldValue = ref('')//确认密码
// 点击确认修改密码
const comfig = async () => {
    if (yuanValue.value.length == 0 || newValue.value.length == 0 || newOldValue.value.length == 0) {
        ElMessage({
            message: '请输入完整信息',
            type: 'warning',
        })
        return
    }
    let n = await changePassword({
        password: yuanValue.value,
        newPassword: newValue.value,
        repeatPassword: newOldValue.value
    })
    if (n.code != 200) {
        ElMessage({
            type: 'error',
            message: n.msg
        })
    } else {
        ElMessage({
            type: 'success',
            message: n.msg
        })
        visibles.value = false
    }
}
// 组件传值
const props = defineProps({
    item: {
        default: {},
        type: Object,
    },

});
// 点击右上面叉号
const closeFn = () => {
    visibles.value = false
}
// 点击左下面箭头
const zuobian = () => {
    console.log(props.item, '00000000');
}
// 点击取消
const canel = () => {
    visibles.value = false
}
// 暴露
defineExpose({
    visibles
});
</script>

<style lang="scss" scoped>
@function pxfn($px) {
    @return calc($px / 18.4) * 1vw;
}

.bot {
    width: 100%;
    height: pxfn(42);
    justify-content: flex-end;
    margin: pxfn(20) 0;

    .left {
        width: pxfn(78);
        height: pxfn(42);
        line-height: pxfn(42);
        border: pxfn(1) solid #e8eaef;
        border-radius: pxfn(6);
        text-align: center;
        font-size: pxfn(14);
        font-family: PingFang SC, PingFang SC-500;
        font-weight: 500;
        color: #1d2129;
        margin-right: pxfn(10);
        cursor: pointer;
    }

    .right {
        width: pxfn(78);
        height: pxfn(42);
        line-height: pxfn(42);
        background-color: #32bbea;
        border-radius: pxfn(6);
        text-align: center;
        font-size: pxfn(14);
        font-family: PingFang SC, PingFang SC-500;
        font-weight: 500;
        color: #fff;
        cursor: pointer;
    }
}

.top {
    font-size: pxfn(14);
    font-family: PingFang SC, PingFang SC-400;
    font-weight: 400;
    text-align: LEFT;
    color: #1d2129;
    margin-bottom: pxfn(10);

    .yuan {
        font-size: pxfn(14);
        font-family: PingFang SC, PingFang SC-400;
        font-weight: 400;
        text-align: LEFT;
        color: #f0251b;
        margin-right: pxfn(10);
    }

}

.Changinput {
    margin-bottom: pxfn(15);
}

.inp {
    width: 100%;
    height: pxfn(40);
    line-height: pxfn(40);
    border: pxfn(1) solid #e8eaef;
    border-radius: pxfn(6);
    padding-left: pxfn(10);
    font-size: pxfn(14);
    font-family: PingFang SC, PingFang SC-400;
    font-weight: 500;
    text-align: LEFT;
    color: #000;
}

.inp::placeholder {
    font-size: pxfn(14);
    font-family: PingFang SC, PingFang SC-400;
    font-weight: 500;
    text-align: LEFT;
    color: #c2c5cc;
}

.Change {
    font-size: pxfn(20);
    font-family: PingFang SC, PingFang SC-600;
    font-weight: 600;
    text-align: LEFT;
    color: #1d2129;
}

.arrow {
    margin-top: pxfn(0);

    .zuoImg {
        width: pxfn(44);
        height: pxfn(44);
    }
}

::v-deep .el-dialog__title {
    font-weight: 600 !important;
}

.head {
    font-size: pxfn(22);
    font-family: PingFang SC, PingFang SC-600;
    font-weight: 600;
    text-align: left;
    color: #1d2129;
}

.count {
    height: 60vh;
    overflow-y: auto;

    &::-webkit-scrollbar {
        // 隐藏滚动条将宽度设置为0
        background-color: #e8eaec;
        width: 0 !important;
    }
}

.neiRong {
    font-size: pxfn(14);
    font-family: PingFang SC, PingFang SC-400;
    font-weight: 400;
    // text-align: LEFT;
    color: #4e5769;
    line-height: 2;
}

.time {
    font-size: pxfn(14);
    font-family: PingFang SC, PingFang SC-400;
    font-weight: 400;
    text-align: LEFT;
    color: #868d9c;
    margin: pxfn(15) 0;
}

::v-deep .el-dialog {
    border-radius: pxfn(15) !important;
}

::v-deep .el-dialog__headerbtn {
    font-size: pxfn(26) !important;
}

::v-deep .el-dialog__body {
    padding-top: pxfn(5);
    padding-bottom: pxfn(5);
}

::v-deep .el-dialog {
    --el-dialog-margin-top: 20vh;
}
</style>